package com.uzai.console.web.user;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.common.SelectVo;
import com.uzai.console.dto.profit.ladderratiogroup.LadderRatioGroupInfoDto;
import com.uzai.console.dto.user.marketingtag.*;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.user.MarketingTagService;
import com.uzai.console.vo.user.marketingtag.MarketingTagReplyVo;
import com.uzai.console.vo.user.marketingtag.MarketingTagVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author liuqi
 * @date 2021年08月25日 20:15
 */
@Api(value = "会员标签",tags = "用户管理|会员标签")
@ApiSort(15)
@RestController
public class MarketingTagContoller extends BaseController {
    private Logger logger = LoggerFactory.getLogger(MarketingTagContoller.class);

    @Autowired
    private MarketingTagService marketingTagService;

    @ApiOperation(value = "分页查询会员标签列表", notes = "分页查询会员标签列表", response = MarketingTagVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/marketingTag/findByPage")
    public Object findMarketingTagByPage(@RequestBody MarketingTagQuery marketingTagQuery){
        return marketingTagService.findMarketingTagByPage(marketingTagQuery);
    }

    @ApiOperation(value = "查询会员标签详情", notes = "查询会员标签详情", response = MarketingTagVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/marketingTag/findById")
    public Object findMarketingTagById(@RequestBody MarketingTagIdDto marketingTagIdDto){
        return marketingTagService.findMarketingTagById(marketingTagIdDto);
    }

    @SystemLogType(model = SystemModelEnum.MarketingTag, type = OperationTypeEnum.ADD)
    @ApiOperation(value = "添加会员标签", notes = "添加会员标签")
    @ApiOperationSupport(order = 3)
    @PostMapping("/marketingTag/add")
    public Object addMarketingTag(@RequestBody MarketingTagDto marketingTagInfoDto){
        marketingTagService.addMarketingTag(marketingTagInfoDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.MarketingTag, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "删除会员标签", notes = "删除会员标签")
    @ApiOperationSupport(order = 4)
    @PostMapping("/marketingTag/delete")
    public Object deleteMarketingTag(@RequestBody MarketingTagIdDto marketingTagIdDto){
        marketingTagService.deleteMarketingTag(marketingTagIdDto);
        return true;
    }

    @ApiOperation(value = "查询会员标签类型下拉列表框", notes = "查询会员标签类型下拉列表框", response = SelectVo.class)
    @ApiOperationSupport(order = 5)
    @PostMapping("/marketingTag/findMarketingTypeListSelect")
    public Object findMarketingTypeListSelect(){
        return marketingTagService.findMarketingTypeListSelect();
    }


    @SystemLogType(model = SystemModelEnum.MarketingTag, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改会员标签", notes = "修改会员标签")
    @ApiOperationSupport(order = 6)
    @PostMapping("/marketingTag/update")
    public Object updateMarketingTag(@RequestBody MarketingTagDto marketingTagInfoDto){
        marketingTagService.updateMarketingTag(marketingTagInfoDto);
        return true;
    }

    @ApiOperation(value = "查询所有会员标签列表", notes = "查询所有会员标签列表", response = MarketingTagVo.class)
    @ApiOperationSupport(order = 7)
    @PostMapping("/marketingTag/findByList")
    public Object findMarketingTagByList(@RequestBody MarketingTagQuery marketingTagQuery){
        return marketingTagService.findMarketingTagByList(marketingTagQuery);
    }

    @ApiOperation(value = "查询会员标签营销奖励回复语详情", notes = "查询会员标签营销奖励回复语详情", response = MarketingTagReplyVo.class)
    @ApiOperationSupport(order = 8)
    @PostMapping("/marketingTag/reply/find")
    public Object findMarketingTagReply(){
        return marketingTagService.findMarketingTagReply(getLoginInfo().getMerId());
    }

    @SystemLogType(model = SystemModelEnum.MarketingTag, type = OperationTypeEnum.UPDATE)
    @ApiOperation(value = "修改会员标签营销奖励回复语", notes = "修改会员标签营销奖励回复语")
    @ApiOperationSupport(order = 9)
    @PostMapping("/marketingTag/reply/update")
    public Object updateMarketingTagReplay(@RequestBody MarketingTagReplyDto marketingTagReplyDto){
        marketingTagService.updateMarketingTagReply(marketingTagReplyDto);
        return true;
    }

    @SystemLogType(model = SystemModelEnum.MarketingTag, type = OperationTypeEnum.COPY)
    @ApiOperation(value = "复制会员标签", notes = "复制会员标签")
    @ApiOperationSupport(order = 10)
    @PostMapping("/marketingTag/copyMarketingTag")
    public Object copyMarketingTag(@RequestBody MarketingTagCopyDto marketingTagCopyDto){
        marketingTagService.copyMarketingTag(marketingTagCopyDto);
        return true;
    }
}
